package com.kma.summer2012.client.view.mainPage.widgets;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.kma.summer2012.client.presenters.mainPage.widgets.IDownBarPresenter;
import com.kma.summer2012.client.styles.style2.Recources;

/**
 * Created with IntelliJ IDEA.
 * User: EUGENE
 * Date: 2/3/13
 * Time: 7:46 PM
 * To change this template use File | Settings | File Templates.
 */
public class
        DownBar extends Composite implements IDownBarPresenter.Display {
    interface DownBarUiBinder extends UiBinder<HTMLPanel, DownBar> {
    }

    @UiField
    protected Button editBtn;

    @UiField
    protected Button deleteBtn;

    @UiField
    protected Button sendForProcessingBtn;

    @UiField
    protected Button rejectBtn;

    @UiField
    protected Button closeBtn;

    @UiField
    protected HorizontalPanel buttonspanel;

    private static DownBarUiBinder ourUiBinder = GWT.create(DownBarUiBinder.class);

    public DownBar() {
        HTMLPanel rootElement = ourUiBinder.createAndBindUi(this);
        setStyles();
        this.initWidget(rootElement);
    }

    public void setStyles() {
        deleteBtn.addStyleName(Recources.INSTANCE.styles().Caption());
        sendForProcessingBtn.addStyleName(Recources.INSTANCE.styles().Caption());
        rejectBtn.addStyleName(Recources.INSTANCE.styles().Caption());
        closeBtn.addStyleName(Recources.INSTANCE.styles().Caption());
        editBtn.addStyleName(Recources.INSTANCE.styles().Caption());
    }

    public HasClickHandlers getEditBtn() {
        return editBtn;
    }


    public HasClickHandlers getDeleteBtn() {
        return deleteBtn;
    }

    public HasClickHandlers getSendForProcessingBtn() {
        return sendForProcessingBtn;
    }

    public HasClickHandlers getRejectBtn() {
        return rejectBtn;
    }

    public HasClickHandlers getCloseBtn() {
        return closeBtn;
    }

    @Override
    public void enableEditBtn(Boolean enable) {
        this.editBtn.setEnabled(enable);
    }

    @Override
    public void enableDeleteBtn(Boolean enable) {
        this.deleteBtn.setEnabled(enable);
    }

    @Override
    public void enableSendForProcessingBtn(Boolean enable) {
        this.sendForProcessingBtn.setEnabled(enable);
    }

    @Override
    public void enableRejectBtn(Boolean enable) {
        this.rejectBtn.setEnabled(enable);
    }

    @Override
    public void enableCloseBtn(Boolean enable) {
        this.closeBtn.setEnabled(enable);
    }

    @Override
    public void showEditBtn(Boolean show) {
        this.editBtn.setVisible(show);
    }

    @Override
    public void showDeleteBtn(Boolean show) {
        this.deleteBtn.setVisible(show);
    }

    @Override
    public void showSendForProcessingBtn(Boolean show) {
        this.sendForProcessingBtn.setVisible(show);
    }

    @Override
    public void showRejectBtn(Boolean show) {
        this.rejectBtn.setVisible(show);
    }

    @Override
    public void showCloseBtn(Boolean show) {
        this.closeBtn.setVisible(show);
    }

    @Override
    public void setEditButtonText(String text) {
        this.editBtn.setText(text);
    }

}